require('./index.css')
require('page/common/top-head-menu/index.js')
require('page/common/head-search/index.js')
require('page/common/footer/index.js')
require('page/common/bread-menu/index.js')
require('page/common/right-easy-menu/index.js')
require('page/common/inquery/index.js')
import validate from 'jquery-validation';
import _mm from 'util/mm.js'
import _tool from 'util/tool';
import _all from 'service/all-service';

const page ={
    init() {
        this.initList();
        this.bindEvent();
    },
    initList() {
        const tpl = require('./allProductList.string');
        let html = '';
        _all.getAllType(res => {
            html = _mm.renderHtml(tpl, {data: res.data});
            $('.product-content').html(html);
        }, err => {
            _tool.msgShakeLayer(err.message);
        });
    },
    bindEvent() {
        const addBmenu = function () {
            const $this = $(this);
            _tool.pushNode($this);
        };
        $('.product-con').on('click', '.product-item a', addBmenu);
        $('.product-con').on('click', '.product-name a', addBmenu);
    }
};

module.export = page.init();